/**
 * @file setting_bluetooth.h
 *
 */
#ifndef SETTING_BLUETOOTH_H
#define SETTING_BLUETOOTH_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#if USE_LV_BLUETOOTH != 0

#include "../../../lvgl/hal/hal_bt.h"
/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/
enum {
    PROCESS_PAIR = 0,
    PROCESS_CONNECT,
    PROCESS_UNPAIR,
    PROCESS_DISCONNECT,
};
typedef uint8_t bt_process;

enum {
    PROCESS_SEND_FILE = 0,
    PROCESS_RECV_FILE,
    PROCESS_PAIRED_CONFIRM
};
typedef uint8_t bt_file_trans_process;

typedef struct
{
    lv_watch_obj_ext_t obj_ext;
    lv_style_t btn_rel;
    lv_obj_t * paired_label;
    lv_obj_t * available_label;
    lv_obj_t * refresh_btn;
    lv_obj_t * dev_list;
    lv_obj_t * title_label;
    lv_obj_t * opening_label;
    lv_obj_t * sw;
    lv_obj_t * mbox;
    lv_obj_t * preload;
} lv_bluetooth_obj_ext_t;
/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**
 * Create a setting bluetooth application
 */
void bluetooth_create_btn_action(lv_obj_t * btn, lv_event_t e);
lv_bluetooth_obj_ext_t * bluetooth_get_ext(void);
void bluetooth_show_object(bool state);
void bluetooth_update_scan_label_show(void);
void bluetooth_nvm_save_switch_state(bool state);
bool bluetooth_setting_is_active(void);
void bluetooth_update_display(void);
void bluetooth_stop_scaning_anim(void);
void bluetooth_processing_mbox_update(void);
bool bluetooth_start_without_ui(void);
void bluetooth_receive_file_confirm(uint8_t is_finish);
void bluetooth_transfer_file_finish(bt_file_trans_process process, uint8 success);
void bluetooth_transfer_file_process_update(bt_file_trans_process process);
void bluetooth_receive_file_process_update_and_finish(void);
void bluetooth_send_file_mbox(char * name);
void bluetooth_send_file_start(void);
bool bluetooth_transfer_file_warning(void);
void bluetooth_receive_file_abort_tip(uint8_t reason);
void bluetooth_transfer_mbox_update(void);
void bluetooth_paired_confirm(char * dev_name, char * addr);
void bluetooth_paired_processing_mbox_update(void);
#if USE_LV_WATCH_SD_AUTO_MOUNT != 0
extern void bluetooth_for_mount_destory(void);
#endif
/**********************
 *      MACROS
 **********************/

#endif /*USE_LV_WATCH_BLUETOOTH*/

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*SETTING_BLUETOOTH_H*/
